<template>
  <div id="app">
    <router-view v-if="isRouterAlive"></router-view>
  </div>
</template>

<script>
export default {
  name: 'app',
  provide() {
    return {
      reload: this.reload,
      isRouterAlive:this.isRouterAlive
    }
  },
  data() {
    return {
      isRouterAlive: true
    }
  },
  methods: {
    reload() {
      this.isRouterAlive = false
      // $nextTick()  在所有DOM都加载完成后调用
      this.$nextTick(() => this.isRouterAlive = true)
    }
  },
}
</script>

<style lang="scss">
#nprogress .bar {
  background: skyblue !important;
}
</style>
